from django.db import router
from django.urls import path
from rest_framework.routers import DefaultRouter

from drfstudy.views import *

# from drfstudy.views import StudentViewSet
# urlpatterns = [
#     path('students/', StudentViewSet.as_view({'get': 'list', 'post': 'create'})),
#     path('students/<pk>/', StudentViewSet.as_view({'get': 'retrieve','put': 'update','delete': 'destory'  })),
# ]

urlpatterns = []
# 创建路由器
router = DefaultRouter()
# 注册路由
router.register('students', StudentViewSet)  # 学生的路由器
router.register('classes', ClassesViewSet)  # 班级的路由器
# 追加至接口路由列表中
urlpatterns += router.urls
